import { ComponentWithStore } from 'mobx-miniprogram-bindings'
import { userStore } from '@/store/userStore'

ComponentWithStore({
  storeBindings: {
    store: userStore,
    fields: ['token', 'userInfo']
  },

  data: {
    aboutList: [
      {
        icon: 'wodekefu',
        title: '小程序相关问题可联系客服咨询'
      },
      {
        icon: 'time',
        title: '客服工作时间为早上8:00-12:00，下午14:00-18:30'
      },
      {
        icon: 'tixing',
        title: '暂不支持退换，特殊情况请联系客服'
      },
      {
        icon: 'dingjianjishutuandui',
        title: '关于我们'
      }
    ]
  },
  methods: {
    goLogin() {
      wx.navigateTo({
        url: '/pages/login/login'
      })
    },
    goSetting() {
      wx.navigateTo({
        url: '/pages/settings/settings'
      })
    },
    goAddressList() {
      wx.navigateTo({
        url: '/modules/settingsModule/pages/address/address-list/address-list'
      })
    },
    goGoodsOrder() {
      if (!this.data.token) {
        this.goLogin()
        return
      }
      wx.navigateTo({
        url: '/modules/orderModule/pages/order/order-list/order-list'
      })
    },
    noop() {
      wx.toast({ title: '该功能暂未开发，请联系客服' })
    }
  }
})
